var e = require;
var t = module;
var o = exports;
var n = o;
Object.defineProperty(n, "__esModule", {value: !0});
var i = (function () {
    function e(e, t, o) {
        if (
            ((this.name = ""),
            (this.isNode = !1),
            (this.count = 0),
            (this.isNode = !1),
            (this.name = e),
            (this.pool = new cc.NodePool()),
            (this.count = o),
            (this.resItem = t),
            this.resItem)
        )
            for (var n = 0; n < o; n++) {
                var i = this.getNode();
                this.pool.put(i);
            }
    }
    return (
        (e.prototype.setNodeRes = function (e) {
            (this.isNode = !0), (this.resItemNode = e);
            for (var t = 0; t < this.count; t++) {
                var o = this.getNode();
                this.pool.put(o);
            }
        }),
        (e.prototype.getName = function () {
            return this.name;
        }),
        (e.prototype.get = function () {
            return this.pool.size() > 0 ? this.pool.get() : this.getNode();
        }),
        (e.prototype.getNode = function () {
            return !this.isNode && this.resItem
                ? cc.instantiate(this.resItem)
                : this.isNode && this.resItemNode
                ? cc.instantiate(this.resItemNode)
                : (console.error(" 预制体没有赋值 "), null);
        }),
        (e.prototype.size = function () {
            return this.pool.size();
        }),
        (e.prototype.put = function (e) {
            this.pool.put(e);
        }),
        (e.prototype.clear = function () {
            this.pool.clear();
        }),
        e
    );
})();
n.default = i;
